//KSP-IslandCargoPrep - Kerbal Space Program: Prepare KSC Island Airfield to Receive Cargo

CONTRACT_TYPE
{


//REQUIREMENTS FOR CONTRACT TO APPEAR

	REQUIREMENT
	{
		name = CompleteContract
		type = CompleteContract

		contractType = KSP-IslandPrep
		minCount = 1
		
	}
	
	REQUIREMENT
	{
		name = PartUnlocked
		type = PartUnlocked
		
		part = sensorBarometer
		
	}

	
//DATA NODES TO PROCESS FOR CONTRACT USE

//Contract Specific VesselParameterGroup Definition Key (to prevent conflict with other active contracts)
	DATA
	{
		type = string
		
		craft = GAPcraftKSPIslandCargoPrep
		
	}


//CONTRACT DESCRIPTION

	name = KSP-IslandCargoPrep
	title = Prepare KSC Island Airfield to Receive Cargo
	group = Kerbal Space Program
	agent = Kerbal Space Program

	description = Gene Kerman says that the KSC Island Airfield needs a faster way to deliver cargo to and from the mainland. Slow surface ships do this currently, but he thinks if airplanes can be made to carry passengers, then certainly they can be made to carry cargo. He wants you to test the concept out by picking up a container of cargo waiting for you at the KSC Spaceplane Hangar Air Terminal, and deliver it by air to the KSC Island Airfield. The container contains a barometer, so to avoid confusion with data contamination, your aircraft must not have any barometers on board. Gene will have his engineers provide the designs of the cargo container to your engineers so you can design and test a craft to carry it.

	synopsis = Pick up a cargo container waiting for you at the terminal, fly it to the KSC Island Airfield, land, and unload the cargo.

	notes = You may use an airplane, helicopter, or VTOL.
	
	completedMessage = Cargo Delivered! Gene Kerman has certified the KSC Island Airfield to receive cargo by plane. Check in with Mission Control for future cargo delivery opportunities.

//Contract Limits
	maxCompletions = 0
	maxSimultaneous = 1
//	weight = 10.0

	autoAccept = false
	declinable = true
	cancellable = true

	minExpiry = 7.0
	maxExpiry = 7.0
	deadline = 0

//Contract Reward Modifiers
	prestige = Trivial
	targetBody = Kerbin
	
//Contract Rewards
  	advanceFunds = 8000.0
	rewardFunds = 8000.0
  	rewardReputation = 10.0
 	rewardScience = 2.0
	
//Contract Penalties
  	failureFunds = 8000.0
	failureReputation = 20.0
	

//BEHAVIOURS TO DO WHEN CREATING CONTRACT
	BEHAVIOUR
	{
		name = CopyCraftFile
		type = CopyCraftFile
		
		url = ContractPacks/GAP/Assets/Sea/KSC Coast Guard Buoy.craft
		craftType = VAB
		onState = CONTRACT_ACCEPTED
		
	}
	
	BEHAVIOUR
	{
		name = LandingZones
		type = WaypointGenerator
		
		//Island Airfield Waypoint
		PQS_CITY
		{
			name = KSC Island Airfield
			icon = marker
			
			targetBody = Kerbin
			pqsCity = IslandAirfield
			pqsOffset = -44.0509605753032, -247.057216484056, 18.0797328829649
			altitude = 24
			hidden = true
		
		}

	}
	
	
//PARAMETERS FOR CONTRACT COMPLETION

//Craft definition
	PARAMETER
	{
		name = VesselParameterGroup
		type = VesselParameterGroup
		title = Your craft must
		
		define = @/craft
		dissassociateVesselsOnContractCompletion = true

		PARAMETER
		{
			name = HasCrew
			type = HasCrew
			title = have a pilot
			
			trait = Pilot
			minCrew = 1
		
			disableOnStateChange = false
			hideChildren = true

		}
		
		PARAMETER
		{
			name = HasCrew
			type = HasCrew
			title = have an engineer
			
			trait = Engineer
			minCrew = 1
		
			disableOnStateChange = false
			hideChildren = true

		}
		
		PARAMETER
		{
			name = HasCrew
			type = HasCrew
			title = have a scientist
			
			trait = Scientist
			minCrew = 1
		
			disableOnStateChange = false
			hideChildren = true

		}
		
		PARAMETER
		{
			name = HasCrewCapacity
			type = HasCrewCapacity
			title = have at least 1 passenger seat
			
			minCapacity = 4
			
			disableOnStateChange = false
			
		}
		
		PARAMETER
		{
			name = All
			type = All
			title = have 2 buoys on board
		
			PARAMETER
			{
				name = PartValidation
				type = PartValidation
				title = each having a barometer

				part = sensorBarometer
				minCount = 2

				disableOnStateChange = true
				hideChildren = true
				
			}
			
			PARAMETER
			{
				name = PartValidation
				type = PartValidation
				title = and have no other barometers on board your aircraft

				part = sensorBarometer
				maxCount = 2

				disableOnStateChange = true
				hideChildren = true
				
			}
		
		}

//This must be disabled in order to collect science. Normally its disabledonStateChange set to false to prevent passengers from tripping up the contract prematurely, but this contract is one exception since there are no Kerbals that can trip the science check.
		disableOnStateChange = true

	}

//Contract Goals
//Buoy Drop Zone 1
	PARAMETER
	{
		name = VesselParameterGroup
		type = VesselParameterGroup
		title = navigate to Buoy Drop Zone 1 (5km Zone)
		
		vessel = @/craft

		PARAMETER
		{
			name = VisitWaypoint
			type = VisitWaypoint
			
			index = 5
			distance = 5000
			hideOnCompletion = true
			
			disableOnStateChange = true
			hideChildren = true
			
		}
	
		disableOnStateChange = true
		hideChildren = true
		
	}

	PARAMETER
	{
		name = drop1stBuoy
		type = PartValidation
		title = drop 1st buoy
		
		part = sensorBarometer
		maxCount = 1

		completeInSequence = true
		disableOnStateChange = true
		hideChildren = true
		
	}

//Buoy Drop Zone 2
	PARAMETER
	{
		name = VesselParameterGroup
		type = VesselParameterGroup
		title = navigate to Buoy Drop Zone 2 (5km Zone)
		
		vessel = @/craft
		
		PARAMETER
		{
			name = VisitWaypoint
			type = VisitWaypoint
			
			index = 6
			distance = 5000
			hideOnCompletion = true
			
			disableOnStateChange = true
			hideChildren = true
			
		}

		disableOnStateChange = true
		hideChildren = true
		
	}

	PARAMETER
	{
		name = drop2ndBuoy
		type = PartValidation
		title = drop 2nd buoy
		
		NONE
		{
			part = sensorBarometer
		
		}

		completeInSequence = true
		disableOnStateChange = true
		hideChildren = true
		
	}
	
//Recovery Parameter - Landing
	PARAMETER
	{
		name = Any
		type = Any
		title = and then land and stop
		
		PARAMETER
		{
			name = Any
			type = Any
			title = at one of the following recovery areas
			
			PARAMETER
			{
				name = VesselParameterGroup
				type = VesselParameterGroup
				title = the KSC Island Airfield
				
				vessel = @/craft
				
				REQUIREMENT
				{
					name = CompleteContract
					type = CompleteContract

					contractType = KSP-IslandPrep
					minCount = 1
					
				}

				PARAMETER
				{			            
					name = ReachState   
					type = ReachState

					situation = LANDED
					maxSpeed = 0.0
					
					completeInSequence = true
					disableOnStateChange = false
					hideChildren = true
					
				}
				
				PARAMETER
				{
					name = VisitWaypoint
					type = VisitWaypoint
					index = 7

					distance = 690
					
					completeInSequence = true
					disableOnStateChange = false
					hideChildren = true
					
				}

				disableOnStateChange = false
				hideChildren = true	

			}
			
			PARAMETER
			{
				name = VesselParameterGroup
				type = VesselParameterGroup
				title = the KSC Runway
				
				vessel = @/craft

				PARAMETER
				{
					name = ReachState
					type = ReachState
					
					targetBody = Kerbin
					biome = Runway
					situation = LANDED
					maxSpeed = 0.0

					disableOnStateChange = false
					hideChildren = true

				}
				
				disableOnStateChange = false
				hideChildren = true

			}
			
			PARAMETER
			{
				name = VesselParameterGroup
				type = VesselParameterGroup
				title = the Vehicle Assembly Building Helipad
				
				vessel = @/craft
				
				REQUIREMENT
				{
					name = CompleteContract
					type = CompleteContract

					contractType = SSI-Helicopter
					minCount = 1
					
				}

				PARAMETER
				{
					name = ReachState
					type = ReachState
					
					targetBody = Kerbin
					biome = VAB Main Building
					situation = LANDED
					maxSpeed = 0.0

					disableOnStateChange = false
					hideChildren = true

				}
				
				disableOnStateChange = false
				hideChildren = true		

			}
			
			PARAMETER
			{
				name = VesselParameterGroup
				type = VesselParameterGroup
				title = or the Spaceplane Hangar Air Terminal
				
				vessel = @/craft

				PARAMETER
				{
					name = ReachState
					type = ReachState
					
					targetBody = Kerbin
					biome = SPH
					situation = LANDED
					maxSpeed = 0.0

					disableOnStateChange = false
					hideChildren = true

				}
				
				disableOnStateChange = false
				hideChildren = true

			}
			
			completeInSequence = true
			disableOnStateChange = false
		
		}
		
		completeInSequence = true
		disableOnStateChange = false

	}

//Recovery Parameter - Craft & Kerbal Safety Check
	PARAMETER
	{
		name = All
		type = All
		title = safely
		
		PARAMETER
		{
			name = VesselNotDestroyed
			type = VesselNotDestroyed
			title = without destroying your aircraft
			
			vessel = @/craft

		}
		
		PARAMETER
		{
			name = KerbalDeaths
			type = KerbalDeaths
			title = or killing anyone
			
			vessel = @/craft

		}
		
		completeInSequence = true
		disableOnStateChange = true
		
	}
	
}